package com.shujia.utils

import java.text.SimpleDateFormat

object DateUtils {
  def diffDate(dateStr1: String, dateStr2: String): Long = {
    val format = new SimpleDateFormat("yyyyMMddHHmmss")
    val ts1: Long = format.parse(dateStr1).getTime
    val ts2: Long = format.parse(dateStr2).getTime
    Math.abs(ts1 - ts2) / 1000
  }

  def main(args: Array[String]): Unit = {
    println(diffDate("20180503104943","20180503104959"))
  }

}
